package com.baidu.automata.core.type;

import org.apache.commons.lang3.StringUtils;
import org.dom4j.Element;
import org.w3c.dom.Node;

public class BooleanField extends BasicDataField<Boolean> {
	private Boolean value;

	public BooleanField() {
		super();
	}

	public BooleanField(String id) {
		super(id);
	}

	@Override
	protected Boolean getValue() {
		return this.value;
	}

	@Override
	protected void setValue(Boolean value) {
		this.value = value;
	}

	@Override
	public void deserialize(Element e) throws Exception {
		this.id = e.attributeValue("id");
		String text = e.getTextTrim();
		this.value = StringUtils.isBlank(text) ? null : Boolean.parseBoolean(text);
	}

	@Override
	public Node serialize() throws Exception {
		return null;
	}

}
